<?php


namespace App\Transformers\Template;


use App\Models\TemplateMessage;
use League\Fractal\TransformerAbstract;

class TemplateMessageTransformer extends TransformerAbstract
{
    public function transform(TemplateMessage $data)
    {
        return [
            'id' => $data->id,
            'system_admin_id' => $data->system_admin_id ?? 0,
            'template_id' => $data->template_id ?? '',
            'template_key' => $data->template_key ?? '',
            'name' => $data->name ?? '',
            'content' => $data->content ?? '',
            'status' => $data->status ?? '',
            'created_at' => $data->created_at ? $data->created_at->format("Y-m-d H:i:s") : '',
        ];
    }
}






